// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import RestaurantDetail from '../views/RestaurantDetail.vue';
import UserProfile from '../views/UserProfile.vue';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/restaurant/:id', // 动态路由，id 是参数
    name: 'RestaurantDetail',
    component: RestaurantDetail,
    props: true
  },
  {
    path: '/user/profile',
    name: 'UserProfile',
    component: UserProfile
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;